package com.ssy.jt808.gateway.sdk.terminal.message.location;

import com.ssy.jt808.gateway.sdk.terminal.constant.LocationMessageEnum;
import com.ssy.jt808.gateway.sdk.terminal.message.TerminalMessageBase;
import com.ssy.jt808.gateway.sdk.terminal.pojo.info.LocationInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * 设备批量定位消息
 *
 * @author wangzezhou
 */
@Data
@NoArgsConstructor
public class LocationMessage extends TerminalMessageBase<LocationMessageEnum>{

  private List<LocationInfo> locationInfos;

  public LocationMessage( int locationSize ){
    locationInfos = new ArrayList<>(locationSize);
  }

  public void addLocation( LocationInfo locationInfo ){

    if( locationInfos == null ){
      locationInfos = new LinkedList<>();
    }

    locationInfos.add(locationInfo);
  }

  /** 消息类型 */
  @Override
  public LocationMessageEnum type(){
    return LocationMessageEnum.Realtime;
  }

}
